package com.springbootquartz.Job_Test;

import lombok.extern.slf4j.Slf4j;
import org.quartz.*;

@Slf4j
public class PlayGameJob implements Job {

    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        // 获取JobDataMap，该Map在创建JobDetail的时候设置的
        JobDataMap jobDataMap = context.getJobDetail().getJobDataMap();
        String gameName = jobDataMap.getString("gameName");
        float gamePrice = jobDataMap.getFloat("gamePrice");
        System.out.println("我玩的" + gameName + "才花费了我" + gamePrice + "块钱");
        log.info("我玩的{}才花费了{}块钱", gameName, gamePrice);
    }
}
